import { BasicArchivesConfigModule } from '@joy.Erp/basic-archives/config';
import { AccountConfigModule } from '@abp/ng.account/config';
import { CoreModule } from '@abp/ng.core';
import { registerLocale } from '@abp/ng.core/locale';
import { IdentityConfigModule } from '@abp/ng.identity/config';
import { SettingManagementConfigModule } from '@abp/ng.setting-management/config';
import { TenantManagementConfigModule } from '@abp/ng.tenant-management/config';
import { ThemeLeptonXModule } from '@abp/ng.theme.lepton-x';
import { SideMenuLayoutModule } from '@abp/ng.theme.lepton-x/layouts';
import { ThemeBasicModule } from '@abp/ng.theme.basic';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { APP_ROUTE_PROVIDER } from './route.provider';

import { NZ_I18N } from 'ng-zorro-antd/i18n';
import { zh_CN } from 'ng-zorro-antd/i18n';
import { HashLocationStrategy, LocationStrategy, registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { RouteReuseStrategy } from '@angular/router';

import {
  LayoutModule,
  AccountModule,
  IdentityModule,
  TenantManagementModule,
  SettingManagementModule,
  RouteTabReuseStrategy,
  MessageModule,
  WidgetModule,
} from 'joy-abpui-angular';
import { BasicArchivesModule } from './basic-archives';

registerLocaleData(zh);

@NgModule({
  imports: [
    BasicArchivesConfigModule.forRoot(),
    BrowserModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    CoreModule.forRoot({
      environment,
      registerLocaleFn: registerLocale(),
    }),
    ThemeSharedModule.forRoot(),
    AccountConfigModule.forRoot(),
    IdentityConfigModule.forRoot(),
    TenantManagementConfigModule.forRoot(),
    SettingManagementConfigModule.forRoot(),
    ThemeLeptonXModule.forRoot(),
    SideMenuLayoutModule.forRoot(),
    ThemeBasicModule.forRoot(),
    FormsModule,
    HttpClientModule,
    LayoutModule.forRoot(),
    AccountModule.forRoot(),
    IdentityModule.forRoot(),
    TenantManagementModule.forRoot(),
    SettingManagementModule.forRoot(),
    MessageModule.forRoot(),
    BasicArchivesModule.forRoot(),
    WidgetModule,
  ],
  declarations: [AppComponent],
  providers: [
    APP_ROUTE_PROVIDER,
    { provide: NZ_I18N, useValue: zh_CN },
    { provide: LocationStrategy, useClass: HashLocationStrategy },
    { provide: RouteReuseStrategy, useClass: RouteTabReuseStrategy },
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}
